package LeetDev.a3d;

import javax.microedition.khronos.opengles.GL10;

/**
 * Base class for EventHandlers.
 * An EventHandler is a class responsible for handling events such as screen updating and user input.
 * EventHandlers are supposed to be self contained parts of the program. Everything loaded into the Engine from the init method  is supposed to be unloaded from the destruct method.
 * It is perfectly OK for an EventHandler to set a new EventHandler in the Engine. This can be used to "chain" different event handlers like different game levels or UI parts.
 * @author Micael Hildenborg
 */
public class EventHandler {
	/**
	 * Class constructor.
	 */
	public EventHandler()
	{
		
	}
	/**
	 * The init function will be called from Engine class, so that the inherited EventHandler can initialize. 
	 * @param gl reference to an OpenGL ES 1.0 object.
	 * @see Engine#onDrawFrame
	 */
	public void init(GL10 gl)
	{
		
	}
	/**
	 * The destruct method will be called from the Engine when the inherited EventHandler is unloaded. 
	 * @param gl reference to an OpenGL ES 1.0 object.
	 * @see Engine#onDrawFrame
	 */
	public void destruct(GL10 gl)
	{
		Mesh.eraseTransparencyList();
	}
	/**
	 * The Engine will queue events like user input, and before each frame is drawn, send all events through this method.
	 * So no event will affect anything inbetween frames or during draw.
	 * @param event  
	 * @see Engine#onDrawFrame
	 * @see Event
	 */
	public void handleEvent(final Event event) {}
	/**
	 * All frame events will be sent directly to this method before any drawing or animation is done.
	 * This method is the perfect place to do scene updating.
	 * @param gl reference to an OpenGL ES 1.0 object.
	 * @param time Continuous counter of real time seconds.
	 * @param deltaTime Seconds since last frame event.
	 */
	public void frameEvent(GL10 gl, double time, double deltaTime) {}

}
